#include "Object.h"


Object::Object()
{
}


Object::~Object()
{
	for (size_t i = 0; i < _polygons.size(); i++)
	{
		delete _polygons[i];
	}
}

void Object::Transform(const Matrix4 & matrix)
{
	for (size_t i = 0; i < _polygons.size(); i++)
	{
		_polygons[i]->Transform(matrix);
	}
}


void ObjectBuilder::Begin()
{
	_result.reset(new Object);
}

void ObjectBuilder::AddPolygon(Polygon * polygon)
{
	_result->_polygons.push_back(polygon);
}

Object * ObjectBuilder::Grab()
{
	return _result.release();
}
